def calculate_boys_1000m_score(student_time, student_cell, xlsx_name, sheet):
    # print(type(student_time))
    if type(student_time) != float and type(student_time) != int:
        # 将字符串时间格式转换为总秒数进行计算
        try:
            minutes, seconds = map(int, student_time.split('\''))
            # print(minutes, seconds)
            total_seconds = minutes * 60 + seconds

            # 定义男生1000米跑的评分区间
            intervals = [(3*60 + 7, 120.00), (3*60, 110), (3*60 + 14, 115), (3*60 + 21, 110), (3*60 + 28, 105), (3*60 + 35, 100)]

            # 根据时间计算得分
            if total_seconds <= intervals[0][0]:

                return intervals[0][1]
            elif total_seconds <= 215:
                # 区间100-120,相差7秒差5分
                return round(120 - ((total_seconds - 187) * (5/7)), 2)
            elif total_seconds <= 315:
                # 区间100-0
                return round(100 - ((total_seconds - 215) * (5/5)), 2)

            else:
                # 在区间内计算得分
                # 第一区间
                # student_time_diff = intervals[i][0] - intervals[i-1][0]
                # score_diff = intervals[i-1][1] - intervals[i][1]
                # print(student_time_diff, score_diff)
                return 0  # intervals[i-1][1] + (intervals[i-1][0] - total_seconds) / student_time_diff * score_diff
        except Exception as e:
            # print(e)
            if student_time is None:
                # print("第%d行，男生数据是空" % student_cell)
                print('【{}】工作簿，【{}】工作表，第【{}】行，【1000米】成绩为空！！！'.format(xlsx_name, sheet, student_cell))
            else:
                # print("第%d行，%s数据有错误请检查" % (student_cell, student_time))
                print('【{}】工作簿，【{}】工作表，第【{}】行，【1000米】【{}】数据错误'.format(xlsx_name, sheet, student_cell, student_time))
    else:
        # 将字符串时间格式转换为总秒数进行计算
        try:
            # minutes, seconds = map(int, student_time.split('\''))
            # print(minutes, seconds)
            minutes = int(student_time)
            seconds = student_time*100 - minutes*100
            total_seconds = minutes * 60 + seconds

            # 定义男生1000米跑的评分区间
            intervals = [(3*60 + 7, 120.00), (3*60, 110), (3*60 + 14, 115), (3*60 + 21, 110), (3*60 + 28, 105), (3*60 + 35, 100)]

            # 根据时间计算得分
            if total_seconds <= intervals[0][0]:

                return intervals[0][1]
            elif total_seconds <= 215:
                # 区间100-120,相差7秒差5分
                return round(120 - ((total_seconds - 187) * (5/7)), 2)
            elif total_seconds <= 315:
                # 区间100-0
                return round(100 - ((total_seconds - 215) * (5/5)), 2)

            else:
                # 在区间内计算得分
                # 第一区间
                # student_time_diff = intervals[i][0] - intervals[i-1][0]
                # score_diff = intervals[i-1][1] - intervals[i][1]
                # print(student_time_diff, score_diff)
                return 0  # intervals[i-1][1] + (intervals[i-1][0] - total_seconds) / student_time_diff * score_diff
        except Exception as e:
            # print(e)
            if student_time is None:
                # print("第%d行，男生数据是空" % student_cell)
                print('【{}】工作簿，【{}】工作表，第【{}】行，【1000米】成绩为空！！！'.format(xlsx_name, sheet, student_cell))
            else:
                # print("第%d行，%s数据有错误请检查" % (student_cell, student_time))
                print('【{}】工作簿，【{}】工作表，第【{}】行，【1000米】数据【{}】错误'.format(xlsx_name, sheet, student_cell, student_time))


def calculate_girls_1000m_score(student_time, student_cell, xlsx_name, sheet):
    # 将字符串时间格式转换为总秒数进行计算
    if student_time is not None:
        try:
            if type(student_time) != float and type(student_time) != int:
                minutes, seconds = map(int, student_time.split('\''))
                total_seconds = minutes * 60 + seconds
                # 根据区间计算分数
                if total_seconds <= 172:

                    return 120.00
                elif total_seconds <= 200:
                    # 区间100-120,相差7秒差5分
                    return round(120 - ((total_seconds - 172) * (5 / 7)), 2)
                elif total_seconds <= 300:
                    # 区间100-0
                    return round(100 - ((total_seconds - 200) * (5 / 5)), 2)
        except Exception as e:
            print('【{}】工作簿，【{}】工作表，第【{}】行，800米成绩【{}】错误！！！'.format(xlsx_name, sheet, student_cell, student_time))
            return None
    else:
        print('【{}】工作簿，【{}】工作表，第【{}】行，【800米】成绩为空！！！'.format(xlsx_name, sheet, student_cell))
# boys_score = calculate_boys_1000m_score("3'14")  # 用实际时间替换"3:15"

# girls_score = calculate_girls_1000m_score("4:33")  # 用实际时间替换"3:10"

# boys_score, girls_score

# print(boys_score, girls_score)
"""
这段 代码可以根据输入的时间（以"分钟:秒"的格式）来计算1000米跑的得分。您可以通过替换示例用法中的时间来计算特定成绩的分数。
"""